import {NgModule} from '@angular/core';
import {RouterModule, Routes} from "@angular/router";
import {ProductComponent} from "./product.component";
import {ProductDetailComponent} from "./product-detail/product-detail.component";
import {ProductListComponent} from "./product-list/product-list.component";
import {ProductDialogComponent} from "./product-dialog/product-dialog.component";
import {ProductResolver} from "./product.resolver";
import { NzMessageModule } from 'ng-zorro-antd/message';
import { NzModalModule } from 'ng-zorro-antd/modal';
import { NzBreadCrumbModule } from 'ng-zorro-antd/breadcrumb';
import { NzTableModule } from 'ng-zorro-antd/table';
import { NzToolTipModule } from 'ng-zorro-antd/tooltip';
import { NzSelectModule } from 'ng-zorro-antd/select';
import { NzLayoutModule } from 'ng-zorro-antd/layout';
import { NzButtonModule } from 'ng-zorro-antd/button';
import { NzInputModule } from 'ng-zorro-antd/input';
import { NzDatePickerModule } from 'ng-zorro-antd/date-picker';
import { NzRadioModule } from 'ng-zorro-antd/radio';
import { NzFormModule } from 'ng-zorro-antd/form';
import { NzIconModule } from 'ng-zorro-antd/icon';
import { NzTabsModule } from 'ng-zorro-antd/tabs';
import { NzDividerModule } from 'ng-zorro-antd/divider';
import { NzUploadModule } from 'ng-zorro-antd/upload';
import { NzEmptyModule } from 'ng-zorro-antd/empty';
import { NzPaginationModule } from 'ng-zorro-antd/pagination';
import { NzTagModule } from 'ng-zorro-antd/tag';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { SharedModule } from 'src/app/shared/shared.module';

const routes: Routes = [
    {
        path: '',
        component: ProductComponent,
        children: [
            {
                path: 'detail/:id',
                data:{ title: 'Product-Detail'},
                component: ProductDetailComponent,
                resolve: {
                    data: ProductResolver
                }
            },
            {
                path: 'list',
                data:{ title: 'Product-List'},
                component: ProductListComponent,
            },
            {
                path: '**',
                redirectTo: 'list'
            }
        ]
    }
];

@NgModule({
    declarations: [ProductComponent, ProductListComponent, ProductDetailComponent, ProductDialogComponent],
    providers: [ProductResolver],
    imports: [
        RouterModule.forChild(routes),
        CommonModule,
        FormsModule,
        NzMessageModule,
        NzModalModule,
        NzBreadCrumbModule,
        NzTableModule,
        NzToolTipModule,
        NzSelectModule,
        NzButtonModule,
        NzInputModule,
        NzDatePickerModule,
        NzRadioModule,
        NzFormModule,
        NzIconModule,
        NzTabsModule,
        NzDividerModule,
        NzUploadModule,
        NzLayoutModule,
        NzEmptyModule,
        NzPaginationModule,
        NzTagModule,
        SharedModule
    ]
})
export class ProductModule {
}
